<html>
  <head>
    <title>Django OpenID Example Consumer</title>
    <style type="text/css">
    div.message {
        background: #9f9;
        padding: 0.5em;
        margin-top: 0.5em;
        margin-bottom: 0.5em;
        border: 1px solid #555;
        font-weight: bold;
    }

    div.error {
        background: #f99;
        padding: 0.5em;
        margin-top: 0.5em;
        margin-bottom: 0.5em;
        border: 1px solid #555;
        font-weight: bold;
    }

    div.box {
        background: #eee;
        border: 1px solid black;
        padding: 1em;
    }
    </style>
  </head>
  <body>

  <div class="box">

  <p>
    This is an example consumer built for the Django framework.  Enter
    an OpenID in the box below.
  </p>

  {% if error %}
    <div class="error">{{ error|escape }}</div>
  {% endif %}

  {% if url %}
    <div class="message">
      OpenID authentication succeeded; you authenticated as
        <a href="{{ url }}">{{ url|escape }}</a>.

      <p>
      {% if sreg_response %}
        Simple Registration data returned:
        <ul>
        {% for key, value in sreg_response %}
          <li>{{ key }}: {{ value }}</li>
        {% endfor %}
        </ul>
      {% else %}
        The server returned no Simple Registration data.
      {% endif %}

      {% if ax_response %}
        Attribute Exchange data returned:
        <ul>
        {% for pair in ax_response %}
        <li>{{ pair.0 }}: {{ pair.1|join:", " }}</li>
        {% endfor %}
        </ul>
      {% else %}
        The server returned no Attribute Exchange data.
      {% endif %}

      {% if pape %}
        An authentication policy response contained these policies:

        <ul>
          {% for uri in pape.auth_policies %}
            <li><tt>{{ uri }}</tt></li>
          {% endfor %}
        </ul>
      {% else %}
        The server returned no authentication policy data (PAPE).
      {% endif %}
      </p>
    </div>
  {% endif %}

  {% if message %}
    <div class="message">
      {{ message|escape }}
    </div>
  {% endif %}

  {% if failure_reason %}
    <div class="error">
      {{ failure_reason|escape }}
    </div>
  {% endif %}

  <form method="post" action="{{ consumer_url }}"> {% csrf_token %}
    <input type="text" size="40" name="openid_identifier" />

    <p>
    Request service type (automatically if not selected):
    <table>
      {% for key in ns %}
      <tr>
        <td><input type="checkbox" name="ns" value="{{ key }}" id="id_ns_{{ key }}" /></td>
        <td>
          <label for="id_ns_{{ key }}"><tt>
            {{ key }}
          </tt></label>
        </td>
      </tr>
      {% endfor %}
    </table>
    </p>

    <p>
    Request these authentication policies
      (<a href="http://openid.net/specs/openid-provider-authentication-policy-extension-1_0-02.html">PAPE</a>):

    <table>
      {% for pair in pape_policies %}
      <tr>
        <td><input type="checkbox" name="policy_{{ pair.0 }}" id="id_policy_{{ pair.0 }}" /></td>
        <td>
          <label for="id_policy_{{ pair.0 }}"><tt>
            {{ pair.1 }}
          </tt></label>
        </td>
      </tr>
      {% endfor %}
    </table>
    </p>

    <p>
    Request SREG data:
    <table>
      {% for key in sreg %}
      <tr>
        <td><input type="checkbox" name="sreg" value="{{ key }}" id="id_policy_{{ key }}" /></td>
        <td>
          <label for="id_policy_{{ key }}"><tt>
            {{ key }}
          </tt></label>
        </td>
      </tr>
      {% endfor %}
    </table>
    </p>

    <p>
    Request AX data:
    <table>
      {% for key in ax %}
      <tr>
        <td><input type="checkbox" name="ax" value="{{ key }}" id="id_policy_{{ key }}" /></td>
        <td>
          <label for="id_policy_{{ key }}"><tt>
            {{ key }}
          </tt></label>
        </td>
      </tr>
      {% endfor %}
    </table>
    </p>

    <input type="submit" value="Begin" />
  </form>

  </div>

  </body>
</html>
